package com.interview.javabasic.IO;

import java.io.IOException;
import java.net.Socket;
import java.util.Date;

/*
@李子宁
Happy,happy everyday!
冲鸭！
2021/2/28

*/
public class IOClient {

    public static void main(String[] args) {
        //创建多个线程模拟客户端：
        new Thread(() -> {
            try {
                Socket socket = new Socket("127.0.0.1",3333);
                while(true){
                    socket.getOutputStream().write((new Date() + ":hello world").getBytes());
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException e) {


                    }
                }
            } catch (IOException e) {

            }
        }).start();
    }
}
